import { defineStore } from 'pinia'

import { getHomeMultidata } from '@/service/home.js'

const useHomeStore = defineStore("home", {
  state: () => {
    return {
      banners: [],
      recommends: []
    }
  },
  actions: {
    // 获取首页轮播图和推荐栏数据
    async fetchHomeMultidata() {
      const res = await getHomeMultidata()
      console.log(res);
      this.banners = res.data.data.banner.list
      this.recommends = res.data.data.recommend.list
    }
  }
})

export default useHomeStore